import sys
import os
import socket
import time

host = "127.0.0.1"
port = 8001
def Test():
	i = 0
	while i < 10 :
		i = i + 1
		pid = os.fork();
		if pid == 0 :
			j = 0
			while j < 1000 :
				j = j + 1
				s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
				s.connect( (host,port) )
				time.sleep(1);
				s.send("hello world"+str(j)+" "+str(os.getpid())+" \n ")
				s.close()
			break
		

Test()
